package pingce.lucene.sentiment;
import java.io.*;
import java.util.*;
import org.apache.lucene.index.*;
import org.apache.lucene.search.*;

public class AllDocCollector extends Collector{
	public List<ScoreDoc> docs=new ArrayList<ScoreDoc>();
	private Scorer scorer;
	private int docBase;
//	这里设定的是允许乱序
	public boolean acceptsDocsOutOfOrder(){
		return true;
	}
	public void setScorer(Scorer scorer){
		this.scorer=scorer;
	}
	public void setNextReader(IndexReader reader,int docBase){
		this.docBase=docBase;
	}
	public void collect(int doc) throws IOException{
		docs.add(new ScoreDoc(doc+docBase,scorer.score()));
	}
	public void reset(){
		docs.clear();
	}
	public List<ScoreDoc> getHist(){
		return docs;
	}
}
